<template>
	<div>
		 <el-link type="primary" href="/myCenter/addExpert">添加</el-link>
		<el-table :data="expertsData" style="width: 100%">
			<el-table-column label="序号" type="index" width="80"></el-table-column>
			<el-table-column label="头像" width="150">
				<template slot-scope="scope">
					<el-avatar :src="scope.row.headImg"></el-avatar>
				</template>
			</el-table-column>
			<el-table-column prop="name" label="姓名" width="100"></el-table-column>
			<el-table-column prop="sex" label="性别" width="80"></el-table-column>
			<el-table-column prop="company" label="单位" width="200"></el-table-column>
			<el-table-column label="状态" width="80">
				<template slot-scope="scope">
					<el-switch v-model="scope.row.status" active-color="#13ce66" inactive-color="#ff4949"  @change="handleStatus(scope.row)"></el-switch>
					
				</template>
			</el-table-column>
			<el-table-column label="操作" width="150">
				<template slot-scope="scope">
					
					 <el-button type="text" size="small" @click="handleShow(scope.row.id)">查看</el-button>
					<el-button type="text" size="small">编辑</el-button>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
import Table from '@/apis';
export default {
	name: 'expert',
	data() {
		return {
			expertsData: [],
			experst:{},
			currentPage: 1,
			total: 0,
			limit: 20,
			
		};
	},
	created() {
		this.getExpertByPage();
		
	},
	methods: {
		async getExpertByPage() {
			return await Table.getExpertByPage(this.currentPage, this.limit).then(res => {
				this.expertsData = res.data.data;
				this.expertsData.map((val,index,arr)=>{
					val.status=val.status=='0'?false:true;
				})
				
			});
		},
	
		handleStatus(value) {
			console.log(value);
		},
		handleShow(id)
		{
			this.$router.push({path:'/myCenter/showExpert',query:{Id:id}});
		
			//this.$router.push({path:'/myCenter/showExpert/'+id});
		}
	}
};
</script>

<style></style>
